<%@page isELIgnored="false" language="java" import="java.util.*" contentType="text/html; charset=utf-8" %>
<!DOCTYPE html>
<html lang="en">

    <head>
        <%
            String path = request.getContextPath();
            String basePath = request.getScheme() + "://"
                    + request.getServerName() + ":" + request.getServerPort()
                    + path + "/";
        %>
        <base href="<%=basePath%>" />
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="${pageContext.request.contextPath}/assets/js/jquery-1.7.2.js"></script>
        <link href="${pageContext.request.contextPath}/assets/bootstrap/css/bootstrap.min.css" rel="stylesheet">
        <script src="${pageContext.request.contextPath}/assets/bootstrap/js/bootstrap.min.js"></script>
        <title>Plataforma de servio administrativo, CLP</title>
        <!-- CSS -->
        <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:400,100,300,500">

        <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/font-awesome/css/font-awesome.min.css">
		<link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/form-elements.css">
        <link rel="stylesheet" href ="${pageContext.request.contextPath}/assets/css/style.css">
        <link rel="stylesheet" href ="${pageContext.request.contextPath}/assets/css/mycss/mycss_font_color.css">

        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
          <script src="${pageContext.request.contextPath}/assets/js/jquery-1.7.2.js"></script>
            <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
            <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->

        <!-- Favicon and touch icons -->
        <link rel="shortcut icon" href="${pageContext.request.contextPath}/assets/ico/favicon.png">
        <link rel="apple-touch-icon-precomposed" sizes="144x144" href="${pageContext.request.contextPath}/assets/ico/apple-touch-icon-144-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="114x114" href="${pageContext.request.contextPath}/assets/ico/apple-touch-icon-114-precomposed.png">
        <link rel="apple-touch-icon-precomposed" sizes="72x72" href="${pageContext.request.contextPath}/assets/ico/apple-touch-icon-72-precomposed.png">
        <link rel="apple-touch-icon-precomposed" href="${pageContext.request.contextPath}/assets/ico/apple-touch-icon-57-precomposed.png">
        <script>
            $(document).ready(function () {

                var isUserNameRegCorrect=false;
                var isUserPasswordRegCorrect=false;

                $("#btn_login_sumbit").click(function () {
                    // checkUserName();//检查用户名格式
                    // checkPassWord();
                    // if(isUserNameRegCorrect==true&&isUserPasswordRegCorrect==true){
                        var employee_account=$("#form-employee_account").val();
                        var employee_password=$("#form-employee_password").val();
                        $.ajax({
                            url:"${pageContext.request.contextPath}/Action/Action_EmployeeAction_checkUser",
                            data:{"employee_account":employee_account,"employee_password":employee_password},
                            type:"POST",
                            success:function (result) {
                                if(result=="200"){
                                    show_help_block("error","帐号或密码错误，请检查");
                                }
                                else if(result=="100"){
                                    $("#loginForm").submit();
                                }
                                else {
                                }
                            }
                        });
                    // }
                });
                function checkUserName(){
                    isUserNameRegCorrect=false;
                    var username=$("#form-username").val();
                    if(regVerify("#form-employee_account",username)==true){
                        isUserNameRegCorrect=true;
                    }
                }
                function checkPassWord(){
                    isUserPasswordRegCorrect=false;
                    var password=$("#form-password").val();
                    if(regVerify("#form-employee_password",password)==true){
                        isUserPasswordRegCorrect=true;
                    }
                }



                $("#form-username").bind('input propertychange', function(){
                    checkUserName();
                });

                $("#form-password").bind('input propertychange', function(){
                    checkPassWord();
                });

                function regVerify(ele,regWord) {
                    var reg=/^[a-z0-9_-]{3,16}$/;
                    var tip="用户名密码格式不对，请输入3-16位数字或字母";
                    if(reg.test(regWord)){
                        show_help_block("success","格式输入正确！");
                        return true;
                    }
                    else{
                        show_help_block("error",tip);
                        return false;
                    }
                }


                function show_help_block(status,msg) {
                    if(status=="success"){
                        $("#login_info").parent().addClass("has-success");
                        $("#login_info").text(msg);
                    }else if(status=="error"){
                        // $(ele).parent().addClass("has-warning");
                        $("#login_info").parent().addClass("has-warning");
                        $("#login_info").text(msg);
                    }
                }

            });

        </script>
    </head>

    <body>

        <!-- Top content -->
        <div class="top-content">

            <div class="inner-bg">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-8 col-sm-offset-2 text">
                            <h1><strong><p class="font_color">QS青山控股</p></strong></h1>
                            <div class="description">
                            	<p class="font_color">行政服务平台</p>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-6 col-sm-offset-3 form-box">
                        	<div class="form-top">
                        		<div class="form-top-left">
                                    <h3><p class="font_color">在这里登录行政服务平台</p></h3>
                            		<p class="font_color">在此输入您的帐号密码：</p>
                        		</div>
                        		<div class="form-top-right">
                        			<i class="fa fa-lock"></i>
                        		</div>
                            </div>
                            <div class="form-bottom">
			                    <form role="form" action="${pageContext.request.contextPath}/Action/Action_EmployeeAction_login" method="post" class="login-form" id="loginForm">
			                    	<div class="form-group">
			                    		<label class="sr-only" for="form-employee_account">Username</label>
			                        	<input type="text"  placeholder="账号..." class="form-employee_account form-control" id="form-employee_account" name="employee_account" value="admin">
                                        <br/>
                                    </div>
			                        <div class="form-group">
			                        	<label class="sr-only" for="form-employee_password">Password</label>
			                        	<input type="password"  placeholder="密码..." class="form-employee_password form-control" id="form-employee_password" name="employee_password" value="">
                                        <br/>
                                    </div>
                                    <div>
                                        <span id="login_info" class="help-block"></span>
                                        <br/>
                                    </div>
                                    <button id="btn_login_sumbit" type="button" class="btn">登录</button>
                                </form>
		                    </div>


                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-6 col-sm-offset-3 social-login">
                        </div>
                    </div>
                </div>
            </div>

        </div>


        <!-- Javascript -->
        <script src="${pageContext.request.contextPath}/assets/js/jquery-1.7.2.js"></script>
        <script src="${pageContext.request.contextPath}/assets/bootstrap/js/bootstrap.min.js"></script>
        <script src="${pageContext.request.contextPath}/assets/js/jquery.backstretch.min.js"></script>
        <script src="${pageContext.request.contextPath}/assets/js/scripts.js"></script>

        <!--[if lt IE 10]>
            <script src="${pageContext.request.contextPath}/assets/js/placeholder.js"></script>
        <![endif]-->


</body>

</html>